package com.howie.parnote.util;

/**
 * Created by HY on 2014/12/8 0008.
 */
public class StringUtil {

	/**
	 * 判断字符串是否为空
	 *
	 * @param str
	 * @return
	 */
	public static boolean notEmpty(final String str) {
		return str == null || "".equals(str.trim()) ? false : true;
	}

	public static boolean notEmpty(final String... strs) {
		for (String str : strs) {
			if (str == null || "".equals(str.trim()))
				return false;
		}
		return true;
	}

	public static boolean isEmpty(final String str) {
		return str == null || "".equals(str.trim()) ? true : false;
	}

	/**
	 * 将字符串首字母替换为小写
	 *
	 * @param source
	 * @return
	 */
	public static String replaceFirstToLower(final String source) {
		return source.substring(0, 1).toLowerCase() + source.substring(1, source.length());
	}

	public static String getXORValue(final String a, final String b) {
		if (notEmpty(a) && isEmpty(b))
			return a;
		else if (isEmpty(a) && notEmpty(b))
			return b;
		else
			throw new IllegalArgumentException();
	}

}
